Skip to content

report_ai() 🚀 - #599

Merged
strengejacke merged 17 commits into
mainfrom
report_ai
May 18, 2026
Merged

report_ai() 🚀 #599
strengejacke merged 17 commits into
mainfrom
report_ai

Conversation

@DominiqueMakowski

@DominiqueMakowski DominiqueMakowski commented Apr 27, 2026

Copy link
Copy Markdown
Member

#596

Currently mostly a proof of concept for lm glm, and lmer glmmtmb

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds an AI-oriented reporting mode to the report package, enabling compact, structured model summaries suitable for LLM/agent consumption via report_ai() and a new audience switch in report().

Changes:

  • Introduces report_ai() S3 generic + methods for lm, glm, merMod, and glmmTMB, plus a print.report_ai() method.
  • Extends report() with an audience argument and a global report_audience option to route output to AI vs human formats.
  • Adds documentation, tests, NEWS entry, and a vignette explaining usage and global document/project configuration.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
vignettes/report_ai.Rmd New vignette describing AI-optimized reporting workflow and global option usage.
tests/testthat/test-report_ai.R Adds test coverage for report_ai() methods and report(audience=...) dispatch.
man/report_ai.Rd New generated help page for report_ai() and its methods.
man/report.Rd Updates report() documentation to include the new audience argument.
R/report_ai.R Implements report_ai() generic/methods, formatting logic, and print method.
R/report.R Adds audience argument + routing from report() to report_ai().
NEWS.md Documents the new AI reporting feature set.
NAMESPACE Registers S3 methods and exports for report_ai + print method.
DESCRIPTION Bumps version and adds report_ai.R to Collate.

Comment thread R/report_ai.R Outdated
Comment thread R/report_ai.R Outdated
Comment thread R/report.R
Comment on lines +105 to 110
report <- function(x, ..., audience = getOption("report_audience", "humans")) {
audience <- match.arg(audience, c("humans", "ai"))
if (audience == "ai") {
return(report_ai(x, ...))
}
UseMethod("report")
Comment thread R/report_ai.R
Comment on lines +107 to +108
params <- parameters::model_parameters(x, ...)

Comment thread NEWS.md Outdated
@@ -1,3 +1,13 @@
# report 0.6.x
Comment thread tests/testthat/test-report_ai.R
@bwiernik

Copy link
Copy Markdown
Contributor

To avoid confusion about capabilities, maybe call it report_ai_prompt()?

@DominiqueMakowski

Copy link
Copy Markdown
Member Author

To avoid confusion about capabilities, maybe call it report_ai_prompt()?

not sure it's much less confusing, but anyways, I think this function should borderline be private, and we should document its usage through report(x, audience="ai"), which can be set via global options. This way we encourage users to essentially write the same documents for both humans and AI

DominiqueMakowski and others added 3 commits April 27, 2026 14:12
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@bwiernik

Copy link
Copy Markdown
Contributor

Good point. Maybe don't export it in that case?

@strengejacke

Copy link
Copy Markdown
Member

@gemini-code-assist review

@strengejacke strengejacke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See also test failures:

  • pkgdown
  • html
  • check warnings

@strengejacke

Copy link
Copy Markdown
Member

@gemini-code-assist review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces report_ai(), a new feature designed to generate compact, structured statistical reports optimized for Large Language Models (LLMs). The report() function has been updated with an audience argument to toggle between standard human-readable prose and the new AI-optimized format, with support for lm, glm, merMod, and glmmTMB model classes. Feedback focuses on maintaining compatibility with R versions prior to 4.1.0 by replacing the native pipe operator |> and adhering to the project's style guide by using insight package helpers for warnings, formula formatting, and call deparsing.

Comment thread R/report_ai.R Outdated
Comment thread R/report_ai.R Outdated
Comment thread tests/testthat/test-report_ai.R Outdated
Comment thread R/report_ai.R Outdated
Comment thread R/report_ai.R
Comment thread R/report_ai.R
@strengejacke

Copy link
Copy Markdown
Member

I think it LGTM now.

@strengejacke

Copy link
Copy Markdown
Member

Oh, you still did not add report_ai to the pkgdown

@DominiqueMakowski

Copy link
Copy Markdown
Member Author

@strengejacke wdyt do we export report_ai or just document it through report(..., audience="ai")?

@strengejacke

strengejacke commented Apr 29, 2026

Copy link
Copy Markdown
Member

Hm... I think we should do the latter, just document the audience option. Then we would not need to add it to pkgdown.

@DominiqueMakowski

Copy link
Copy Markdown
Member Author
image

@strengejacke

Copy link
Copy Markdown
Member

Ready to merge?

@DominiqueMakowski

Copy link
Copy Markdown
Member Author

ready 🫡

@strengejacke
strengejacke merged commit 83ca663 into main May 18, 2026
25 of 28 checks passed
@strengejacke
strengejacke deleted the report_ai branch May 18, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants